﻿using System;
using System.Collections.Generic;
using System.Linq;
using DataBaseLayer.Abstractions;
using DataBaseLayer.Abstractions.Interfaces.Services;
using DataBaseLayer.Dto;
using DataBaseLayer.Extensions;

namespace DataBaseLayer.Services
{
	public class LogOrdersService : BaseService, ILogOrdersService
	{
		#region Constructors

		public LogOrdersService(DocumentManager dataBase)
			: base(dataBase) { }

		#endregion

		#region ILogOrdersService Members

		public IEnumerable<LogOrderData> GetLogOrdersByDateRange(DateTime startDate, DateTime endDate)
		{
			return DataBase.LogOrders.Where(lo => lo.Date >= startDate && lo.Date <= endDate).OrderBy(lo => lo.Date).ToDtos();
		}

		#endregion
	}
}
